import { request } from '@gui-pkg/request';
import { getMenuListResultModel } from './model/menuModel';

enum Api {
  GetMenuList = '/api/data/sys/menu/list',
  AddMenu = '/api/data/sys/menu/add',
  EditMenu = '/api/data/sys/menu/edit',
  DelMenu = '/api/data/sys/menu/delete/',
  GetMenuTreeList = '/api/data/sys/menu/roleMenuTreeselect/',
  GetAllMenuTreeList = '/api/data/sys/menu/treeselect',
}

/**
 * @description: Get user menu based on id
 */
/*export const getMenuList = (params) => {
  return request.get<getMenuListResultModel>({ url: Api.GetMenuList, params });
};*/

// 本地地图GeoJson数据，去除请求的一些参数
const requestOptions = {
  withToken: false,
};
export const getMenuList = () => {
  //return request.get({ url: '/data/menuData.json' }, requestOptions);
  return request.get({ url: Api.GetMenuList });
};



//新增菜单
export const addMenuList = (params) => {
  return request.post({ url: Api.AddMenu, params });
};

//修改菜单
export const editMenuList = (params) => {
  return request.post({ url: Api.EditMenu, params });
};

//删除菜单
export const deleteMenuList = (params) => {
  return request.get({ url: Api.DelMenu+params });
};

//获取菜单下拉数列表
export const getMenuTreeList = (roleId) => {
  return request.get({ url: Api.GetMenuTreeList+roleId });
};

export const getAllMenuTreeList = ( ) => {
  return request.get({ url: Api.GetAllMenuTreeList });
};
